/**
 * [OElove] (C)2010-2099 OELOVE.COM Inc. X
 * Email: service@phpcoo.com ,phpcoo@qq.com
 * This is NOT a freeware, use is subject to license terms
 * $ Last update 2016/12/01 by CL $
*/
$(function(){
	//关闭
	$("[f='but_close_setname']").click(function(){
		$("#setname_box").fadeOut(100);
	});

	//确定修改
	$("[f='but_edit_name']").click(function(){
		$obj_tips  = $("#edit_tips");
		$username = $("#username").val();
		if ($username.length == 0) {
			$obj_tips.html("请输入用户名/昵称");
			return false;
		}
		else {
			$obj_tips.html("");
		}
		$.ajax({
			type: "POST",
			url: _ROOT_PATH + "index.php?c=passport",
			cache: false,
			data: {a:"setname", username:$username, r:get_rndnum(8)},
			dataType: "json",
			success: function($data) {
				$json = eval($data);
				$response = $json.response;
				$result = $json.result;
				if ($response == "1") { //成功
					//$obj_tips.html("<font color='green'>修改成功</font>");
					$("#setname_box").fadeOut(100);
					ToastShow("修改成功");
				}
				else {
					if ($result.length > 0) {
						$obj_tips.html($result);
					}
					else {
						$obj_tips.html("修改失败");
					}
				}
			},
			error: function() {
			}
		});

	});
});